<template>
    <div class="table">
        <!--主体-->
        <div class="container">
            <i class="el-icon-refresh" style="font-size: 18px;padding-bottom: 20px" @click="update"></i>
            <!--搜索-->
            <div class="handle-box">
                <el-input v-model="select_word" placeholder="筛选关键词" class="handle-input mr10"
                          @keyup.enter.native="search">
                    <i slot="prefix" class="el-input__icon el-icon-search"></i>
                </el-input>
                <el-button type="primary" icon="search" @click="search">搜索</el-button>
                <el-button type="success" size="small" @click="handleAdd">新增</el-button>
            </div>
            <!--表格-->
            <el-table :data="tableData" border style="width: 100%">
                <el-table-column label="医院ID" prop="real_id"></el-table-column>
                <el-table-column label="医院级别" prop="hco_grade_level"></el-table-column>
                <el-table-column label="医院名字" prop="display_name"></el-table-column>
                <el-table-column label="医院所在地" prop="province"></el-table-column>
                <el-table-column label="操作" width="230">
                    <template slot-scope="scope">
                        <el-button size="small" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
                        <el-button size="small" type="danger" @click="handleDelete(scope.$index, scope.row)">删除
                        </el-button>
                        <el-button size="small" type="primary" @click="associated(scope.$index, scope.row)">对应ID
                        </el-button>
                    </template>
                </el-table-column>
            </el-table>
        </div>
        <!-- 编辑弹出框 -->
        <el-dialog title="编辑" :visible.sync="editVisible" width="40%">
            <el-form ref="form" :model="form" label-width="100px">
                <el-form-item label="ID">
                    <el-input v-model="form.id" disabled></el-input>
                </el-form-item>
                <el-form-item label="评级ID">
                    <el-input v-model="form.level_id" disabled></el-input>
                </el-form-item>
                <el-form-item label="等级ID">
                    <el-input v-model="form.grade_id" disabled></el-input>
                </el-form-item>
                <el-form-item label="级别">
                    <el-input v-model="form.level" disabled></el-input>
                </el-form-item>
                <el-form-item label="等级">
                    <el-input v-model="form.grade" disabled></el-input>
                </el-form-item>
                <el-form-item label="显示名字">
                    <el-input v-model="form.display_name"></el-input>
                </el-form-item>
                <el-form-item label="医院别名">
                    <el-input type="textarea" v-model="form.hco_nickname" :autosize="{ minRows: 2, maxRows: 4}"
                              class="ipt" style="width: 100%">
                    </el-input>
                    <!--                    <el-input v-model="form.hco_nickname"></el-input>-->
                </el-form-item>
                <el-form-item label="医院等级全称">
                    <el-input v-model="form.hco_grade_level"></el-input>
                </el-form-item>
                <el-form-item label="医院分类">
                    <el-input v-model="form.hco_catalog"></el-input>
                </el-form-item>
                <el-form-item label="省">
                    <el-input v-model="form.province"></el-input>
                </el-form-item>
                <el-form-item label="市">
                    <el-input v-model="form.area"></el-input>
                </el-form-item>
                <el-form-item label="区">
                    <el-input v-model="form.district"></el-input>
                </el-form-item>
                <el-form-item label="医院地址">
                    <el-input v-model="form.hco_address"></el-input>
                </el-form-item>
                <el-form-item label="电话">
                    <el-input v-model="form.hco_tel"></el-input>
                </el-form-item>
                <el-form-item label="医院网址">
                    <el-input v-model="form.hco_website"></el-input>
                </el-form-item>
                <el-form-item label="门诊量">
                    <el-input v-model="form.hco_outpatent_num"></el-input>
                </el-form-item>
                <el-form-item label="床位数">
                    <el-input v-model="form.hco_bed_num"></el-input>
                </el-form-item>
                <el-form-item label="员工数">
                    <el-input v-model="form.hco_employee"></el-input>
                </el-form-item>
                <el-form-item label="院长">
                    <el-input v-model="form.dean"></el-input>
                </el-form-item>
                <el-form-item label="建院年份">
                    <el-input v-model="form.hco_build_year"></el-input>
                </el-form-item>
                <el-form-item label="科室数">
                    <el-input v-model="form.hco_dept_num"></el-input>
                </el-form-item>
                <el-form-item label="医院名称">
                    <el-input v-model="form.hco_name" disabled></el-input>
                </el-form-item>
                <el-form-item label="是否激活">
                    <el-input v-model="form.is_active" disabled></el-input>
                </el-form-item>
                <el-form-item label="是否医保">
                    <el-input v-model="form.is_health_insurnace"></el-input>
                </el-form-item>
                <el-form-item label="医院真实UUID">
                    <el-input v-model="form.real_id" disabled></el-input>
                </el-form-item>
                <el-form-item label="更新时间">
                    <el-input v-model="form.updateTime" disabled></el-input>
                </el-form-item>
                <el-form-item label="医院UUID">
                    <el-input v-model="form.uuid" disabled></el-input>
                </el-form-item>
                <el-form-item label="创建时间">
                    <el-input v-model="form.createTime" disabled></el-input>
                </el-form-item>
                <el-form-item label="简介">
                    <el-input type="textarea" v-model="form.hco_info" :autosize="{ minRows: 2, maxRows: 4}"
                              placeholder="请输入内容" class="ipt" style="width: 100%">
                    </el-input>
                </el-form-item>

            </el-form>
            <span slot="footer" class="dialog-footer">
                <el-button @click="editVisible = false">取 消</el-button>
                <el-button type="primary" @click="saveEdit">确 定</el-button>
            </span>
        </el-dialog>
        <!-- 新增提示框 -->
        <el-dialog title="新增" :visible.sync="addVisible" width="40%" center>
            <div class="demo-input-suffix">
                <!--                <div>
                                    <span class="spn">ID:</span><el-input v-model="form1.id" placeholder="请输入内容" class="ipt"></el-input>
                                </div>-->
                <div>
                    <span class="spn">医院名称:</span>
                    <el-input v-model="form1.hco_name" placeholder="请输入内容" class="ipt"></el-input>
                    <span style="padding-left: 10px;color: red" v-show="must1">*必填项</span>
                </div>
                <div>
                    <span class="spn">显示名字:</span>
                    <el-input v-model="form1.display_name" placeholder="请输入内容" class="ipt"></el-input>
                    <span style="padding-left: 10px;color: red" v-show="must2">*必填项</span>
                </div>
                <div>
                    <span class="spn">医院别名:</span>
                    <el-input v-model="form1.hco_nickname" placeholder="请输入内容" class="ipt"></el-input>
                    <span style="padding-left: 10px;color: red" v-show="must3">*必填项</span>
                </div>
                <div>
                    <span class="spn">医院等级:</span>
                    <!--                    <el-input v-model="form1.hco_grade_level" placeholder="请输入内容" class="ipt"></el-input>-->
                    <el-select v-model="form1.hco_grade_level" placeholder="请选择内容" class="ipt">
                        <el-option
                            v-for="item in options"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value">
                        </el-option>
                    </el-select>
                    <span style="padding-left: 10px;color: red" v-show="must4">*必填项</span>
                </div>

                <!--                <div>
                                    <span class="spn">等级:</span>
                                    <el-input v-model="form1.grade" placeholder="请输入内容" class="ipt"></el-input>
                                </div>
                                <div>
                                    <span class="spn">级别:</span>
                                    <el-input v-model="form1.level" placeholder="请输入内容" class="ipt"></el-input>
                                </div>

                                <div>
                                    <span class="spn">评级ID:</span>
                                    <el-input v-model="form1.grade_id" placeholder="请输入内容" class="ipt"></el-input>
                                </div>
                                <div>
                                    <span class="spn">等级ID:</span>
                                    <el-input v-model="form1.level_id" placeholder="请输入内容" class="ipt"></el-input>
                                </div>-->

                <div>
                    <span class="spn">医院分类:</span>
                    <el-input v-model="form1.hco_catalog" placeholder="请输入内容" class="ipt"></el-input>
                    <span style="padding-left: 10px;color: red" v-show="must5">*必填项</span>
                </div>
                <div>
                    <span class="spn">省:</span>
                    <el-input v-model="form1.province" placeholder="请输入内容" class="ipt"></el-input>
                    <span style="padding-left: 10px;color: red" v-show="must6">*必填项</span>
                </div>
                <div>
                    <span class="spn">市:</span>
                    <el-input v-model="form1.area" placeholder="请输入内容" class="ipt"></el-input>
                    <span style="padding-left: 10px;color: red" v-show="must7">*必填项</span>
                </div>
                <div>
                    <span class="spn">区:</span>
                    <el-input v-model="form1.district" placeholder="请输入内容" class="ipt"></el-input>
                    <span style="padding-left: 10px;color: red" v-show="must8">*必填项</span>
                </div>
                <div>
                    <span class="spn">医院地址:</span>
                    <el-input v-model="form1.hco_address" placeholder="请输入内容" class="ipt"></el-input>
                    <span style="padding-left: 10px;color: red" v-show="must9">*必填项</span>
                </div>
                <div>
                    <span class="spn">电话:</span>
                    <el-input v-model="form1.hco_tel" placeholder="请输入内容" class="ipt"></el-input>
                </div>
                <div>
                    <span class="spn">医院网址:</span>
                    <el-input v-model="form1.hco_website" placeholder="请输入内容" class="ipt"></el-input>
                </div>
                <div>
                    <span class="spn">门诊量:</span>
                    <el-input v-model="form1.hco_outpatent_num" placeholder="请输入内容" class="ipt"></el-input>
                </div>
                <div>
                    <span class="spn">床位数:</span>
                    <el-input v-model="form1.hco_bed_num" placeholder="请输入内容" class="ipt"></el-input>
                </div>
                <div>
                    <span class="spn">员工数:</span>
                    <el-input v-model="form1.hco_employee" placeholder="请输入内容" class="ipt"></el-input>
                </div>
                <div>
                    <span class="spn">科室数:</span>
                    <el-input v-model="form1.hco_dept_num" placeholder="请输入内容" class="ipt"></el-input>
                </div>
                <div>
                    <span class="spn">院长:</span>
                    <el-input v-model="form1.dean" placeholder="请输入内容" class="ipt"></el-input>
                </div>
                <div>
                    <span class="spn">建院年份:</span>
                    <el-input v-model="form1.hco_build_year" placeholder="请输入内容" class="ipt"></el-input>
                </div>

                <!--                <div>
                                    <span class="spn">是否激活:</span><el-input v-model="form1.is_active" placeholder="请输入内容" class="ipt"></el-input>
                                </div>-->
                <div>
                    <span class="spn">是否医保:</span>
                    <el-input v-model="form1.is_health_insurnace" placeholder="请输入内容" class="ipt"></el-input>
                </div>
                <div>
                    <span class="spn">简介:</span>
                    <!--                    <el-input v-model="form1.hco_info" placeholder="请输入内容" class="ipt"></el-input>-->
                    <el-input type="textarea" v-model="form1.hco_info" :autosize="{ minRows: 2, maxRows: 4}"
                              placeholder="请输入内容" class="ipt">
                    </el-input>
                </div>
                <!--
                                <div>
                                    <span class="spn">医院真实UUID:</span><el-input v-model="form1.real_id" placeholder="请输入内容" class="ipt"></el-input>
                                </div>
                                <div>
                                    <span class="spn">更新时间:</span><el-input v-model="form1.updateTime" placeholder="请输入内容" class="ipt"></el-input>
                                </div>
                                <div>
                                    <span class="spn">医院UUID:</span><el-input v-model="form1.uuid" placeholder="请输入内容" class="ipt"></el-input>
                                </div>
                                <div>
                                    <span class="spn">创建时间:</span><el-input v-model="form1.createTime" placeholder="请输入内容" class="ipt"></el-input>
                                </div>-->

            </div>
            <span slot="footer" class="dialog-footer">
                <el-button @click="addVisible = false">取 消</el-button>
                <el-button type="primary" @click="adder">确 定</el-button>
            </span>
        </el-dialog>
        <!-- 删除提示框 -->
        <el-dialog title="提示" :visible.sync="delVisible" width="300px" center>
            <div class="del-dialog-cnt">删除不可恢复，是否确定删除？</div>
            <span slot="footer" class="dialog-footer">
                <el-button @click="delVisible = false">取 消</el-button>
                <el-button type="primary" @click="deleteRow">确 定</el-button>
            </span>
        </el-dialog>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                /*医院显示接口*/
                showUrl: '',
                /*医院搜索接口*/
                /*searchUrl: 'http://192.168.1.55:80/hcomdm/hco_query',*/
                searchUrl: 'http://bigdata-api.huimeimt.cn/resource_server/hcomdm/hco_query',
                /*医院增加接口*/
                /*adderUrl: 'http://192.168.1.55/hcomdm/hco_insert',*/
                adderUrl: 'http://bigdata-api.huimeimt.cn/resource_server/hcomdm/hco_insert',
                /*医院删除接口*/
                /*deleteRowUrl: 'http://192.168.1.55/hcomdm/hco_del/',*/
                deleteRowUrl: 'http://bigdata-api.huimeimt.cn/resource_server/hcomdm/hco_del/',
                /*医院编辑接口*/
                /*saveEditUrl: 'http://192.168.1.55/hcomdm/hco_update',*/
                saveEditUrl: 'http://bigdata-api.huimeimt.cn/resource_server/hcomdm/hco_update',

                associatedUrl: 'http://bigdata-api.huimeimt.cn/resource_server/hcohcphandle/hcohcp_relations',
                /*获取token*/
                access_token: '',

                tableData: [],
                /*编辑*/
                editVisible: false,
                /*新增*/
                addVisible: false,
                /*删除*/
                delVisible: false,
                /*搜索*/
                select_word: '',
                is_search: false,
                /*数据*/
                form: {
                    /*id*/
                    id: '',
                    /*评级ID*/
                    grade_id: '',
                    /*等级ID*/
                    level_id: '',
                    /*显示名字*/
                    display_name: '',
                    /*医院别名*/
                    hco_nickname: '',
                    /*医院等级全称*/
                    hco_grade_level: '',
                    /*等级*/
                    grade: '',
                    /*医院分类*/
                    hco_catalog: '',
                    /*省*/
                    province: '',
                    /*市*/
                    area: '',
                    /*区*/
                    district: '',
                    /*医院地址*/
                    hco_address: '',
                    /*电话*/
                    hco_tel: '',
                    /*医院网址*/
                    hco_website: '',
                    /*门诊量*/
                    hco_outpatent_num: '',
                    /*床位数*/
                    hco_bed_num: '',
                    /*简介*/
                    hco_info: '',
                    /*员工数*/
                    hco_employee: '',
                    /*院长*/
                    dean: '',
                    /*建院年份*/
                    hco_build_year: '',
                    /*科室数*/
                    hco_dept_num: '',
                    /*医院名称*/
                    hco_name: '',
                    /*是否激活*/
                    is_active: '',
                    /*是否医保*/
                    is_health_insurnace: '',
                    /*级别*/
                    level: '',
                    /*医院真实UUID*/
                    real_id: '',
                    /*更新时间*/
                    updateTime: '',
                    /*医院UUID*/
                    uuid: '',
                    /*创建时间*/
                    createTime: '',
                },
                /*新增数据*/
                form1: {
                    /*id*/
                    id: '',
                    /*评级ID*/
                    grade_id: '',
                    /*等级ID*/
                    level_id: '',
                    /*显示名字*/
                    display_name: '',
                    /*医院别名*/
                    hco_nickname: "",
                    /*医院等级全称*/
                    hco_grade_level: '',
                    /*等级*/
                    grade: '',
                    /*医院分类*/
                    hco_catalog: '',
                    /*省*/
                    province: '',
                    /*市*/
                    area: '',
                    /*区*/
                    district: '',
                    /*医院地址*/
                    hco_address: '',
                    /*电话*/
                    hco_tel: '',
                    /*医院网址*/
                    hco_website: '',
                    /*门诊量*/
                    hco_outpatent_num: '',
                    /*床位数*/
                    hco_bed_num: '',
                    /*简介*/
                    hco_info: '',
                    /*员工数*/
                    hco_employee: '',
                    /*院长*/
                    dean: '',
                    /*建院年份*/
                    hco_build_year: '',
                    /*科室数*/
                    hco_dept_num: '',
                    /*医院名称*/
                    hco_name: '',
                    /*是否激活*/
                    is_active: '1',
                    /*是否医保*/
                    is_health_insurnace: '',
                    /*级别*/
                    level: '',
                    /*医院真实UUID*/
                    real_id: '',
                    /*更新时间*/
                    updateTime: '',
                    /*医院UUID*/
                    uuid: '',
                    /*创建时间*/
                    createTime: '',
                },
                /*医院等级*/
                options: [
                    {
                        value: '暂无信息',
                        label: '暂无信息'
                    },
                    {
                        value: '三级甲等',
                        label: '三级甲等'
                    }, {
                        value: '三级乙等',
                        label: '三级乙等'
                    }, {
                        value: '三级丙等',
                        label: '三级丙等'
                    }, {
                        value: '二级甲等',
                        label: '二级甲等'
                    }, {
                        value: '二级乙等',
                        label: '二级乙等'
                    }, {
                        value: '二级丙等',
                        label: '二级丙等'
                    }, {
                        value: '一级甲等',
                        label: '一级甲等'
                    }, {
                        value: '一级乙等',
                        label: '一级乙等'
                    }, {
                        value: '一级丙等',
                        label: '一级丙等'
                    }],
                value: '',
                idx: -1,
                must1: false,
                must2: false,
                must3: false,
                must4: false,
                must5: false,
                must6: false,
                must7: false,
                must8: false,
                must9: false,
            }
        },
        created() {
            this.gainTtoken();
        },
        methods: {
            /*获取token*/
            gainTtoken() {
                this.$axios({
                    method: 'GET',
                    url: 'http://bigdata-oauth.huimeimt.cn/Dataplatform/token',
                }).then((res) => {
                    this.access_token = res.data.access_token
                })
            },
            /*编辑处理*/
            handleEdit(index, row) {
                this.idx = index;
                const item = this.tableData[index];
                this.form = {
                    id: item.id,
                    grade_id: item.grade_id,
                    level_id: item.level_id,
                    display_name: item.display_name,
                    hco_nickname: item.hco_nickname,
                    hco_grade_level: item.hco_grade_level,
                    grade: item.grade,
                    hco_catalog: item.hco_catalog,
                    province: item.province,
                    area: item.area,
                    district: item.district,
                    hco_address: item.hco_address,
                    hco_tel: item.hco_tel,
                    hco_website: item.hco_website,
                    hco_outpatent_num: item.hco_outpatent_num,
                    hco_bed_num: item.hco_bed_num,
                    hco_info: item.hco_info,
                    hco_employee: item.hco_employee,
                    dean: item.dean,
                    hco_build_year: item.hco_build_year,
                    hco_dept_num: item.hco_dept_num,
                    hco_name: item.hco_name,
                    is_active: item.is_active,
                    is_health_insurnace: item.is_health_insurnace,
                    level: item.level,
                    real_id: item.real_id,
                    updateTime: item.updateTime,
                    uuid: item.uuid,
                    createTime: item.createTime,
                };
                this.editVisible = true;

            },
            /*保存编辑*/
            saveEdit() {
                this.gainTtoken();
                /*等级、评级ID*/
                if (this.form.hco_grade_level.indexOf('甲等') == 2) {
                    this.form.grade = '甲级';
                    this.form.grade_id = '01'
                } else if (this.form.hco_grade_level.indexOf('乙等') == 2) {
                    this.form.grade = '乙级';
                    this.form.grade_id = '02'
                } else if (this.form.hco_grade_level.indexOf('丙等') == 2) {
                    this.form.grade = '丙级';
                    this.form.grade_id = '03'
                } else {
                    this.form.grade = '暂无信息';
                    this.form.grade_id = '00'
                }
                /*级别、等级ID*/
                if (this.form.hco_grade_level.indexOf('三级') == 0) {
                    this.form.level = '三级';
                    this.form.level_id = '03'
                } else if (this.form.hco_grade_level.indexOf('二级') == 0) {
                    this.form.level = '二级';
                    this.form.level_id = '02'
                } else if (this.form.hco_grade_level.indexOf('一级') == 0) {
                    this.form.level = '一级';
                    this.form.level_id = '01'
                } else {
                    this.form.level = '暂无信息';
                    this.form.level_id = '00'
                }

                this.saveEditReq()
            },
            saveEditReq() {
                this.$axios({
                    method: 'POST',
                    headers: {'Content-Type': 'application/json;charset=UTF-8'},
                    data: JSON.stringify(this.form),
                    url: this.saveEditUrl + "?access_token=" + this.access_token,
                }).then((res) => {
                    this.editVisible = false;
                    this.$message.success(`修改第 ${this.idx + 1} 行成功`);
                    location.reload();
                })
            },
            /*新增处理*/
            handleAdd() {
                this.addVisible = true;
            },
            /*确定新增*/
            adder() {
                this.gainTtoken();
                const timestamp = Date.parse(new Date());
                this.form1.createTime = this.format(timestamp);
                this.form1.updateTime = this.format(timestamp);
                this.examination();
            },
            addData() {
                this.$axios({
                    method: 'POST',
                    headers: {'Content-Type': 'application/json;charset=UTF-8'},
                    data: JSON.stringify(this.form1),
                    url: this.adderUrl + "?access_token=" + this.access_token,
                }).then((res) => {
                    this.addVisible = false;
                    this.$message.success(`新增成功`);
                    location.reload();
                })
            },
            /*删除处理*/
            handleDelete(index, row) {
                this.idx = index;
                this.delVisible = true;
            },
            /*确定删除*/
            deleteRow() {
                this.gainTtoken();
                let data = this.tableData.splice(this.idx, 1);
                for (let i in data) {
                    this.$axios.delete(this.deleteRowUrl + data[i].id + "?access_token=" + this.access_token)
                        .then((res) => {
                            this.delVisible = false;
                            this.$message.success('删除成功');
                        })
                        .catch((err) => {
                            console.log(err);
                        });
                }
            },
            /*搜索*/
            search() {
                this.gainTtoken();
                if (this.select_word.length > 0) {
                    this.is_search = true;
                    let data = {"data": this.excludeSpecial(this.select_word)};
                    this.$axios({
                        method: 'POST',
                        headers: {'Content-Type': 'application/json;charset=UTF-8'},
                        url: this.searchUrl + "?access_token=" + this.access_token,
                        data: JSON.stringify(data),
                    }).then((res) => {
                        this.tableData = res.data.result;
                        if (res.data.result != "") {
                            /*                            this.$message('成功!');*/
                        }
                    }).catch((err) => {
                        console.log(err);
                    });
                }
            },
            /*搜索、id*/
            associated(index, row) {
                this.idx = index;
                let data = this.tableData.splice(this.idx, 1);
                for (let i in data) {
                    let database = {
                        "real_id": data[i].real_id,
                        "search_name": this.select_word
                    };
                    this.$axios({
                        method: 'POST',
                        headers: {'Content-Type': 'application/json;charset=UTF-8'},
                        url: this.associatedUrl + "?access_token=" + this.access_token,
                        data: JSON.stringify(database),
                    }).then((res) => {
                        this.$message('成功!');
                    })
                }
            },
            /*时间戳转换*/
            add0(m) {
                return m < 10 ? '0' + m : m
            },
            format(timestamp) {
                var time = new Date(timestamp);
                var year = time.getFullYear();
                var month = time.getMonth() + 1;
                var date = time.getDate();
                var hours = time.getHours();
                var minutes = time.getMinutes();
                var seconds = time.getSeconds();
                return year + '-' + this.add0(month) + '-' + this.add0(date) + ' ' + this.add0(hours) + ':' + this.add0(minutes) + ':' + this.add0(seconds);
            },
            /*交验*/
            examination() {
                /*医院名称*/
                if (this.form1.hco_name == "") {
                    this.must1 = true;
                    return false;
                } else {
                    this.must1 = false;
                }
                /*显示名字*/
                if (this.form1.display_name == "") {
                    this.must2 = true;
                    return false;
                } else {
                    this.must2 = false
                }
                /*医院别名*/
                if (this.form1.hco_nickname == "") {
                    this.must3 = true;
                    return false;
                } else {
                    this.must3 = false
                }
                /*医院等级*/
                if (this.form1.hco_grade_level == "") {
                    this.must4 = true;
                    return false;
                } else {
                    this.must4 = false
                }
                /*医院分类*/
                if (this.form1.hco_catalog == "") {
                    this.must5 = true;
                    return false;
                } else {
                    this.must5 = false
                }
                /*省*/
                if (this.form1.province == "") {
                    this.must6 = true;
                    return false;
                } else {
                    this.must6 = false
                }
                /*市*/
                if (this.form1.area == "") {
                    this.must7 = true;
                    return false;
                } else {
                    this.must7 = false
                }
                /*区*/
                if (this.form1.district == "") {
                    this.must8 = true;
                    return false;
                } else {
                    this.must8 = false
                }
                /*医院地址*/
                if (this.form1.hco_address == "") {
                    this.must9 = true;
                    return false;
                } else {
                    this.must9 = false
                }
                /*等级、评级ID*/
                if (this.form1.hco_grade_level.indexOf('甲等') == 2) {
                    this.form1.grade = '甲级'
                    this.form1.grade_id = '01'
                } else if (this.form1.hco_grade_level.indexOf('乙等') == 2) {
                    this.form1.grade = '乙级'
                    this.form1.grade_id = '02'
                } else if (this.form1.hco_grade_level.indexOf('丙等') == 2) {
                    this.form1.grade = '丙级'
                    this.form1.grade_id = '03'
                } else if (this.form1.hco_grade_level == "暂无信息") {
                    this.form1.grade = '暂无信息'
                    this.form1.grade_id = '00'
                }
                /*级别、等级ID*/
                if (this.form1.hco_grade_level.indexOf('三级') == 0) {
                    this.form1.level = '三级'
                    this.form1.level_id = '03'
                } else if (this.form1.hco_grade_level.indexOf('二级') == 0) {
                    this.form1.level = '二级'
                    this.form1.level_id = '02'
                } else if (this.form1.hco_grade_level.indexOf('一级') == 0) {
                    this.form1.level = '一级'
                    this.form1.level_id = '01'
                } else if (this.form1.hco_grade_level == "暂无信息") {
                    this.form1.level = '暂无信息'
                    this.form1.level_id = '00'
                }
                /*电话*/
                if (this.form1.hco_tel == '') {
                    this.form1.hco_tel = '暂无信息'
                }
                /*医院网址*/
                if (this.form1.hco_website == '') {
                    this.form1.hco_website = '暂无信息'
                }
                /*门诊量*/
                if (this.form1.hco_outpatent_num == '') {
                    this.form1.hco_outpatent_num = '暂无信息'
                }
                /*床位数*/
                if (this.form1.hco_bed_num == '') {
                    this.form1.hco_bed_num = '暂无信息'
                }
                /*员工数*/
                if (this.form1.hco_employee == '') {
                    this.form1.hco_employee = '暂无信息'
                }
                /*科室数*/
                if (this.form1.hco_dept_num == '') {
                    this.form1.hco_dept_num = '暂无信息'
                }
                /*院长*/
                if (this.form1.dean == '') {
                    this.form1.dean = '暂无信息'
                }
                /*建院年份*/
                if (this.form1.hco_build_year == '') {
                    this.form1.hco_build_year = '暂无信息'
                }
                /*是否医保*/
                if (this.form1.is_health_insurnace == '') {
                    this.form1.is_health_insurnace = '暂无信息'
                }
                /*简介*/
                if (this.form1.hco_info == '') {
                    this.form1.hco_info = '暂无信息'
                }
                this.addData()
            },
            /*刷新*/
            update() {
                location.reload();
            },
            /*去除非法字符*/
            excludeSpecial(s) {
                s = s.replace(/[^\u4e00-\u9fa5a-zA-Z0-9\w]/g, ' ');
                return s;
            }
        }
    }
</script>

<style scoped>
    .handle-box {
        margin-bottom: 20px;
    }

    .handle-input {
        width: 300px;
        display: inline-block;
    }

    .del-dialog-cnt {
        font-size: 16px;
        text-align: center
    }

    .spn {
        display: inline-block;
        width: 20%;
    }

    .ipt {
        padding: 5px 0;
        width: 65%;
    }
</style>
